<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('选择人员')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body class="white-bg">
<div class="ibox-content">
    <div class="nav-tabs-custom">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#education_information" data-toggle="tab" aria-expanded="true">教育信息</a></li>
            <li><a href="#working_information" data-toggle="tab" aria-expanded="false">工作经历</a></li>
            <li><a href="#title_information" data-toggle="tab" aria-expanded="false">职称/资格证书</a></li>
            <li><a href="#training_information" data-toggle="tab" aria-expanded="false">培训经历</a></li>
            <li><a href="#project_information" data-toggle="tab" aria-expanded="false">项目经历</a></li>
            <li><a href="#hortation_information" data-toggle="tab" aria-expanded="false">惩奖经历</a></li>
            <li><a href="#family_information" data-toggle="tab" aria-expanded="false">家庭背景</a></li>
            <li><a href="#language_information" data-toggle="tab" aria-expanded="false">语言能力</a></li>
            <li><a href="#emergency_information" data-toggle="tab" aria-expanded="false">紧急联系人</a></li>
            <li><a href="#certificate_information" data-toggle="tab" aria-expanded="false">证件管理</a></li>
        </ul>
        <div class="tab-content">
            <!--教育信息-->
            <div class="tab-pane active" id="education_information">
                <div class="row">
                    <div class="col-sm-12 select-table table-striped">
                        <a class="btn btn-success" onclick="educationAdd()">
                            <i class="fa fa-plus"></i> 新增
                        </a>
                        <a class="btn btn-primary" onclick="educationEdit()">
                            <i class="fa fa-edit"></i> 修改
                        </a>
                        <a class="btn btn-danger" onclick="educationDelete()">
                            <i class="fa fa-remove"></i> 删除
                        </a>
                        <a class="btn btn-warning" onclick="educationRefresh()">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                        <table id="education-table"></table>
                    </div>
                </div>
            </div>

            <!--工作经历-->
            <div class="tab-pane" id="working_information">
                <div class="row">
                    <div class="col-sm-12 select-table table-striped">
                        <a class="btn btn-success" onclick="workingAdd()">
                            <i class="fa fa-plus"></i> 新增
                        </a>
                        <a class="btn btn-primary" onclick="workingEdit()">
                            <i class="fa fa-edit"></i> 修改
                        </a>
                        <a class="btn btn-danger" onclick="workingDelete()">
                            <i class="fa fa-remove"></i> 删除
                        </a>
                        <a class="btn btn-warning" onclick="workingRefresh()">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                        <table id="working-table"></table>
                    </div>
                </div>
            </div>

            <!--职称/资格证书-->
            <div class="tab-pane" id="title_information">
                <div class="row">
                    <div class="col-sm-12 select-table table-striped">
                        <a class="btn btn-success" onclick="titleAdd()">
                            <i class="fa fa-plus"></i> 新增
                        </a>
                        <a class="btn btn-primary" onclick="titleEdit()">
                            <i class="fa fa-edit"></i> 修改
                        </a>
                        <a class="btn btn-danger" onclick="titleDelete()">
                            <i class="fa fa-remove"></i> 删除
                        </a>
                        <a class="btn btn-warning" onclick="titleRefresh()">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                        <table id="title-table"></table>
                    </div>
                </div>
            </div>

            <!--培训经历-->
            <div class="tab-pane" id="training_information">
                <div class="row">
                    <div class="col-sm-12 select-table table-striped">
                        <a class="btn btn-success" onclick="trainingAdd()">
                            <i class="fa fa-plus"></i> 新增
                        </a>
                        <a class="btn btn-primary" onclick="trainingEdit()">
                            <i class="fa fa-edit"></i> 修改
                        </a>
                        <a class="btn btn-danger" onclick="trainingDelete()">
                            <i class="fa fa-remove"></i> 删除
                        </a>
                        <a class="btn btn-warning" onclick="trainingRefresh()">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                        <table id="training-table"></table>
                    </div>
                </div>
            </div>

            <!--项目经历-->
            <div class="tab-pane" id="project_information">
                <div class="row">
                    <div class="col-sm-12 select-table table-striped">
                        <a class="btn btn-success" onclick="projectAdd()">
                            <i class="fa fa-plus"></i> 新增
                        </a>
                        <a class="btn btn-primary" onclick="projectEdit()">
                            <i class="fa fa-edit"></i> 修改
                        </a>
                        <a class="btn btn-danger" onclick="projectDelete()">
                            <i class="fa fa-remove"></i> 删除
                        </a>
                        <a class="btn btn-warning" onclick="projectRefresh()">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                        <table id="project-table"></table>
                    </div>
                </div>
            </div>

            <!--惩奖经历-->
            <div class="tab-pane" id="hortation_information">
                <div class="row">
                    <div class="col-sm-12 select-table table-striped">
                        <a class="btn btn-success" onclick="hortationAdd()">
                            <i class="fa fa-plus"></i> 新增
                        </a>
                        <a class="btn btn-primary" onclick="hortationEdit()">
                            <i class="fa fa-edit"></i> 修改
                        </a>
                        <a class="btn btn-danger" onclick="hortationDelete()">
                            <i class="fa fa-remove"></i> 删除
                        </a>
                        <a class="btn btn-warning" onclick="hortationRefresh()">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                        <table id="hortation-table"></table>
                    </div>
                </div>
            </div>

            <!--家庭背景-->
            <div class="tab-pane" id="family_information">
                <div class="row">
                    <div class="col-sm-12 select-table table-striped">
                        <a class="btn btn-success" onclick="familyAdd()">
                            <i class="fa fa-plus"></i> 新增
                        </a>
                        <a class="btn btn-primary" onclick="familyEdit()">
                            <i class="fa fa-edit"></i> 修改
                        </a>
                        <a class="btn btn-danger" onclick="familyDelete()">
                            <i class="fa fa-remove"></i> 删除
                        </a>
                        <a class="btn btn-warning" onclick="familyRefresh()">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                        <table id="family-table"></table>
                    </div>
                </div>
            </div>

            <!--语言能力-->
            <div class="tab-pane" id="language_information">
                <div class="row">
                    <div class="col-sm-12 select-table table-striped">
                        <a class="btn btn-success" onclick="languageAdd()">
                            <i class="fa fa-plus"></i> 新增
                        </a>
                        <a class="btn btn-primary" onclick="languageEdit()">
                            <i class="fa fa-edit"></i> 修改
                        </a>
                        <a class="btn btn-danger" onclick="languageDelete()">
                            <i class="fa fa-remove"></i> 删除
                        </a>
                        <a class="btn btn-warning" onclick="languageRefresh()">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                        <table id="language-table"></table>
                    </div>
                </div>
            </div>

            <!--紧急联系人-->
            <div class="tab-pane" id="emergency_information">
                <div class="row">
                    <div class="col-sm-12 select-table table-striped">
                        <a class="btn btn-success" onclick="emergencyAdd()">
                            <i class="fa fa-plus"></i> 新增
                        </a>
                        <a class="btn btn-primary" onclick="emergencyEdit()">
                            <i class="fa fa-edit"></i> 修改
                        </a>
                        <a class="btn btn-danger" onclick="emergencyDelete()">
                            <i class="fa fa-remove"></i> 删除
                        </a>
                        <a class="btn btn-warning" onclick="emergencyRefresh()">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                        <table id="emergency-table"></table>
                    </div>
                </div>
            </div>

            <!--证件管理-->
            <div class="tab-pane" id="certificate_information">
                <div class="row">
                    <div class="col-sm-12 select-table table-striped">
                        <a class="btn btn-success" onclick="certificateAdd()">
                            <i class="fa fa-plus"></i> 新增
                        </a>
                        <a class="btn btn-primary" onclick="certificateEdit()">
                            <i class="fa fa-edit"></i> 修改
                        </a>
                        <a class="btn btn-danger" onclick="certificateDelete()">
                            <i class="fa fa-remove"></i> 删除
                        </a>
                        <a class="btn btn-warning" onclick="certificateRefresh()">
                            <i class="fa fa-refresh"></i> 刷新
                        </a>
                        <table id="certificate-table"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>


<script th:inline="javascript">
    var id;
    var prefix = ctx + "entryManage/EntryBackground";

    $(function () {
        id = [[${id}]];
        education();
        working();
        title();
        training();
        project();
        hortation();
        family();
        language();
        emergency();
        certificate();
    });

    //教育信息
    function education() {
        var options = {
            code: "id",
            uniqueId: "id",
            id: "education-table",
            url: prefix + "/getEducationList?id=" + id,
            removeUrl: prefix + "/remove",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            height: $(window).height() - 120,
            modalName: "教育经历",
            columns: [{
                checkbox: true
            }, {
                field: 'id',
                title: '序号',
            },
                {
                    field: 'BeginDate',
                    title: '开始时间'
                },
                {
                    field: 'EndDate',
                    title: '结束时间'
                },
                {
                    field: 'SchoolName',
                    title: '学校名称'
                },
                {
                    field: 'GradTypeTitle',
                    title: '毕业类型'
                },
                {
                    field: 'StudyTypeTitle',
                    title: '学习形式'
                },
                {
                    field: 'EduTypeTitle',
                    title: '学历类型'
                },
                {
                    field: 'DegreeTypeTitle',
                    title: '学位类型'
                },
                {
                    field: 'DegreeName',
                    title: '学位名称'
                },
                {
                    field: 'Major',
                    title: '专业'
                },
                {
                    field: 'EduNo',
                    title: '学历证书编号'
                },
                {
                    field: 'EduNoDate',
                    title: '学历获得时间'
                },
                {
                    field: 'DegreeNo',
                    title: '学位证书编号'
                },
                {
                    field: 'DegreeNoDate',
                    title: '学位获得时间'
                },
                {
                    field: 'SchoolPlace',
                    title: '学校地址'
                },
                {
                    field: 'Reference',
                    title: '证明人'
                },
                {
                    field: 'Tel',
                    title: '联系方式'
                },
                {
                    field: 'isout',
                    title: '是否海外'
                },
                {
                    field: 'remark',
                    title: '备注'
                }]
        };
        $.table.init(options);
    }
    function educationAdd() {
        $.modal.open("新增教育信息", prefix + "/addEducation?id=" + id);
    }
    function educationEdit() {
        var row = $("#education-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请先选择一条数据");
            return;
        }
        if (row.length > 1) {
            alert("只能选择一条数据");
            return;
        }
        $.modal.open("修改教育信息", prefix + "/editEducation?id=" + row[0].id);
    }
    function educationDelete() {
        var row = $("#education-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请选择数据!");
        }
        var allId = "";
        for (var i = 0; i < row.length; i++) {
            if (i == row.length - 1) {
                allId += row[i].id
            } else {
                allId += row[i].id + ","

            }
        }
        $.ajax({
            async: false,
            url: prefix + "/deleteEducation",
            data: {
                "allId": allId
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    $.modal.alertSuccess('删除成功');
                    $("#education-table").bootstrapTable('refresh');
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.modal.alertWarning("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
    }
    function educationRefresh(){
        $("#education-table").bootstrapTable('refresh');
    }

    //工作经历
    function working() {
        var options = {
            code: "id",
            uniqueId: "id",
            id: "working-table",
            url: prefix + "/getWorkingList?id=" + id,
            removeUrl: prefix + "/remove",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            height: $(window).height() - 120,
            modalName: "工作经历",
            columns: [{
                checkbox: true
            }, {
                field: 'id',
                title: '序号',
            },
                {
                    field: 'begindate',
                    title: '开始时间'
                },
                {
                    field: 'enddate',
                    title: '结束时间'
                },
                {
                    field: 'company',
                    title: '工作单位'
                },
                {
                    field: 'job',
                    title: '担任职务'
                },
                {
                    field: 'workplace',
                    title: '工作地点'
                },
                {
                    field: 'Reference',
                    title: '证明人'
                },
                {
                    field: 'Tel',
                    title: '联系方式'
                },
                {
                    field: 'isout',
                    title: '是否海外'
                },
                {
                    field: 'remark',
                    title: '备注'
                }]
        };
        $.table.init(options);
    };
    function workingAdd() {
        $.modal.open("新增工作经历", prefix + "/addWorking?id=" + id);
    };
    function workingEdit() {
        var row = $("#working-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请先选择一条数据");
            return;
        }
        if (row.length > 1) {
            alert("只能选择一条数据");
            return;
        }
        $.modal.open("修改工作经历", prefix + "/editWorking?id=" + row[0].id);
    };
    function workingDelete() {
        var row = $("#working-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请选择数据!");
        }
        var allId = "";
        for (var i = 0; i < row.length; i++) {
            if (i == row.length - 1) {
                allId += row[i].id
            } else {
                allId += row[i].id + ","

            }
        }
        $.ajax({
            async: false,
            url: prefix + "/deleteWorking",
            data: {
                "allId": allId
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    $.modal.alertSuccess('删除成功');
                    $("#working-table").bootstrapTable('refresh');
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.modal.alertWarning("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
    };
    function workingRefresh(){
        $("#working-table").bootstrapTable('refresh');
    }

    //职称/资格证书
    function title() {
        var options = {
            code: "id",
            uniqueId: "id",
            id: "title-table",
            url: prefix + "/getTitleList?id=" + id,
            removeUrl: prefix + "/remove",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            height: $(window).height() - 120,
            modalName: "职称/资格证书",
            columns: [{
                checkbox: true
            }, {
                field: 'ID',
                title: '序号',
            },
                {
                    field: 'Title',
                    title: '职称/资格证书名称'
                },
                {
                    field: 'effectdate',
                    title: '获得日期'
                },
                {
                    field: 'certNo',
                    title: '证书编号'
                },
                {
                    field: 'Remark',
                    title: '备注'
                }]
        };
        $.table.init(options);
    };
    function titleAdd() {
        $.modal.open("新增职称/资格证书", prefix + "/addTitle?id=" + id);
    };
    function titleEdit() {
        var row = $("#title-table").bootstrapTable('getSelections');
        console.log(row);
        if (row.length == 0) {
            alert("请先选择一条数据");
            return;
        }
        if (row.length > 1) {
            alert("只能选择一条数据");
            return;
        }
        $.modal.open("修改职称/资格证书", prefix + "/editTitle?id=" + row[0].ID);
    };
    function titleDelete() {
        var row = $("#title-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请选择数据!");
        }
        var allId = "";
        for (var i = 0; i < row.length; i++) {
            if (i == row.length - 1) {
                allId += row[i].ID
            } else {
                allId += row[i].ID + ","

            }
        }
        $.ajax({
            async: false,
            url: prefix + "/deleteTitle",
            data: {
                "allId": allId
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    $.modal.alertSuccess('删除成功');
                    $("#title-table").bootstrapTable('refresh');
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.modal.alertWarning("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
    };
    function titleRefresh(){
        $("#title-table").bootstrapTable('refresh');
    }

    //培训经历
    function training() {
        var options = {
            code: "id",
            uniqueId: "id",
            id: "training-table",
            url: prefix + "/getTrainingList?id=" + id,
            removeUrl: prefix + "/remove",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            height: $(window).height() - 120,
            modalName: "培训经历",
            columns: [{
                checkbox: true
            }, {
                field: 'ID',
                title: '序号',
            },
                {
                    field: 'IsJoin',
                    title: '入职前后？'
                },
                {
                    field: 'TraintypeTitle',
                    title: '培训类型'
                },
                {
                    field: 'TrainKindTitle',
                    title: '培训形式'
                },
                {
                    field: 'content',
                    title: '培训主题'
                },
                {
                    field: 'Course',
                    title: '培训课程'
                },
                {
                    field: 'BeginDate',
                    title: '开始时间'
                },
                {
                    field: 'EndDate',
                    title: '结束时间'
                },
                {
                    field: 'place',
                    title: '培训地点'
                },
                {
                    field: 'Vendor',
                    title: '举办机构'
                },
                {
                    field: 'Hours',
                    title: '课时'
                },
                {
                    field: 'Certificate',
                    title: '所获证书'
                },
                {
                    field: 'CertificateNo',
                    title: '证书编号'
                },
                {
                    field: 'Remark',
                    title: '备注'
                }]
        };
        $.table.init(options);
    };
    function trainingAdd() {
        $.modal.open("新增培训经历", prefix + "/addTraining?id=" + id);
    };
    function trainingEdit() {
        var row = $("#training-table").bootstrapTable('getSelections');
        console.log(row);
        if (row.length == 0) {
            alert("请先选择一条数据");
            return;
        }
        if (row.length > 1) {
            alert("只能选择一条数据");
            return;
        }
        $.modal.open("修改培训经历", prefix + "/editTraining?id=" + row[0].ID);
    };
    function trainingDelete() {
        var row = $("#training-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请选择数据!");
        }
        var allId = "";
        for (var i = 0; i < row.length; i++) {
            if (i == row.length - 1) {
                allId += row[i].ID
            } else {
                allId += row[i].ID + ","

            }
        }
        $.ajax({
            async: false,
            url: prefix + "/deleteTraining",
            data: {
                "allId": allId
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    $.modal.alertSuccess('删除成功');
                    $("#training-table").bootstrapTable('refresh');
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.modal.alertWarning("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
    };
    function trainingRefresh(){
        $("#training-table").bootstrapTable('refresh');
    }

    //项目经历
    function project() {
        var options = {
            code: "id",
            uniqueId: "id",
            id: "project-table",
            url: prefix + "/getProjectList?id=" + id,
            removeUrl: prefix + "/remove",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            height: $(window).height() - 120,
            modalName: "项目经历",
            columns: [{
                checkbox: true
            }, {
                field: 'ID',
                title: '序号',
            },
                {
                    field: 'BeginDate',
                    title: '开始时间'
                },
                {
                    field: 'EndDate',
                    title: '结束时间'
                },
                {
                    field: 'ProjName',
                    title: '项目名称'
                },
                {
                    field: 'Description',
                    title: '项目描述'
                },
                {
                    field: 'Job',
                    title: '担任职务'
                },
                {
                    field: 'ProjAddress',
                    title: '项目地址'
                },
                {
                    field: 'Principal',
                    title: '项目负责人'
                },
                {
                    field: 'Remark',
                    title: '备注'
                }]
        };
        $.table.init(options);
    };
    function projectAdd() {
        $.modal.open("新增项目经历", prefix + "/addProject?id=" + id);
    };
    function projectEdit() {
        var row = $("#project-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请先选择一条数据");
            return;
        }
        if (row.length > 1) {
            alert("只能选择一条数据");
            return;
        }
        $.modal.open("修改项目经历", prefix + "/editProject?id=" + row[0].ID);
    };
    function projectDelete() {
        var row = $("#project-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请选择数据!");
        }
        var allId = "";
        for (var i = 0; i < row.length; i++) {
            if (i == row.length - 1) {
                allId += row[i].ID
            } else {
                allId += row[i].ID + ","

            }
        }
        $.ajax({
            async: false,
            url: prefix + "/deleteProject",
            data: {
                "allId": allId
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    $.modal.alertSuccess('删除成功');
                    $("#project-table").bootstrapTable('refresh');
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.modal.alertWarning("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
    };
    function projectRefresh(){
        $("#project-table").bootstrapTable('refresh');
    }

    //惩奖经历
    function hortation() {
        var options = {
            code: "id",
            uniqueId: "id",
            id: "hortation-table",
            url: prefix + "/getHortationList?id=" + id,
            removeUrl: prefix + "/remove",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            height: $(window).height() - 120,
            modalName: "惩奖经历",
            columns: [{
                checkbox: true
            }, {
                field: 'ID',
                title: '序号',
            },
                {
                    field: 'InOut',
                    title: '公司内外?'
                },
                {
                    field: 'HortationTypeTitle',
                    title: '奖惩形式'
                },
                {
                    field: 'HortationKindTitle',
                    title: '奖惩类别'
                },
                {
                    field: 'HappenDate',
                    title: '奖惩时间'
                },
                {
                    field: 'Organizer',
                    title: '实施机构'
                },
                {
                    field: 'Reason',
                    title: '奖惩原因'
                },
                {
                    field: 'Remark',
                    title: '备注'
                }]
        };
        $.table.init(options);
    };
    function hortationAdd() {
        $.modal.open("新增惩奖经历", prefix + "/addHortation?id=" + id);
    };
    function hortationEdit() {
        var row = $("#hortation-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请先选择一条数据");
            return;
        }
        if (row.length > 1) {
            alert("只能选择一条数据");
            return;
        }
        $.modal.open("修改惩奖经历", prefix + "/editHortation?id=" + row[0].ID);
    };
    function hortationDelete() {
        var row = $("#hortation-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请选择数据!");
        }
        var allId = "";
        for (var i = 0; i < row.length; i++) {
            if (i == row.length - 1) {
                allId += row[i].ID
            } else {
                allId += row[i].ID + ","

            }
        }
        $.ajax({
            async: false,
            url: prefix + "/deleteHortation",
            data: {
                "allId": allId
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    $.modal.alertSuccess('删除成功');
                    $("#hortation-table").bootstrapTable('refresh');
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.modal.alertWarning("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
    };
    function hortationRefresh(){
        $("#hortation-table").bootstrapTable('refresh');
    };

    //家庭背景
    function family() {
        var options = {
            code: "id",
            uniqueId: "id",
            id: "family-table",
            url: prefix + "/getFamilyList?id=" + id,
            removeUrl: prefix + "/remove",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            height: $(window).height() - 120,
            modalName: "家庭背景",
            columns: [{
                checkbox: true
            }, {
                field: 'id',
                title: '序号',
            },
                {
                    field: 'fname',
                    title: '家属关系?'
                },
                {
                    field: 'relationTitle',
                    title: '家属关系'
                },
                {
                    field: 'genderTitle',
                    title: '性别'
                },
                {
                    field: 'Birthday',
                    title: '出生日期'
                },
                {
                    field: 'Company',
                    title: '工作单位'
                },
                {
                    field: 'Job',
                    title: '担任职务'
                },
                {
                    field: 'tel',
                    title: '联系电话'
                },
                {
                    field: 'remark',
                    title: '备注'
                }]
        };
        $.table.init(options);
    };
    function familyAdd() {
        $.modal.open("新增家庭背景", prefix + "/addFamily?id=" + id);
    };
    function familyEdit() {
        var row = $("#family-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请先选择一条数据");
            return;
        }
        if (row.length > 1) {
            alert("只能选择一条数据");
            return;
        }
        $.modal.open("修改家庭背景", prefix + "/editFamily?id=" + row[0].id);
    };
    function familyDelete() {
        var row = $("#family-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请选择数据!");
        }
        var allId = "";
        for (var i = 0; i < row.length; i++) {
            if (i == row.length - 1) {
                allId += row[i].id
            } else {
                allId += row[i].id + ","

            }
        }
        $.ajax({
            async: false,
            url: prefix + "/deleteFamily",
            data: {
                "allId": allId
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    $.modal.alertSuccess('删除成功');
                    $("#family-table").bootstrapTable('refresh');
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.modal.alertWarning("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
    };
    function familyRefresh(){
        $("#family-table").bootstrapTable('refresh');
    };

    //语言能力
    function language() {
        var options = {
            code: "id",
            uniqueId: "id",
            id: "language-table",
            url: prefix + "/getLanguageList?id=" + id,
            removeUrl: prefix + "/remove",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            height: $(window).height() - 120,
            modalName: "语言能力",
            columns: [{
                checkbox: true
            }, {
                field: 'ID',
                title: '序号',
            },
                {
                    field: 'LanguageTypeTitle',
                    title: '语言类型'
                },
                {
                    field: 'LanguageGradeTitle',
                    title: '熟练程度'
                },
                {
                    field: 'Certificate',
                    title: '获得证书'
                },
                {
                    field: 'effectDate',
                    title: '证书获得日期'
                },
                {
                    field: 'Remark',
                    title: '备注'
                }]
        };
        $.table.init(options);
    };
    function languageAdd() {
        $.modal.open("新增语言能力", prefix + "/addLanguage?id=" + id);
    };
    function languageEdit() {
        var row = $("#language-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请先选择一条数据");
            return;
        }
        if (row.length > 1) {
            alert("只能选择一条数据");
            return;
        }
        $.modal.open("修改语言能力", prefix + "/editLanguage?id=" + row[0].ID);
    };
    function languageDelete() {
        var row = $("#language-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请选择数据!");
        }
        var allId = "";
        for (var i = 0; i < row.length; i++) {
            if (i == row.length - 1) {
                allId += row[i].ID
            } else {
                allId += row[i].ID + ","

            }
        }
        $.ajax({
            async: false,
            url: prefix + "/deleteLanguage",
            data: {
                "allId": allId
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    $.modal.alertSuccess('删除成功');
                    $("#language-table").bootstrapTable('refresh');
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.modal.alertWarning("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
    };
    function languageRefresh(){
        $("#language-table").bootstrapTable('refresh');
    };

    //紧急联系人
    function emergency() {
        var options = {
            code: "id",
            uniqueId: "id",
            id: "emergency-table",
            url: prefix + "/getEmergencyList?id=" + id,
            removeUrl: prefix + "/remove",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            height: $(window).height() - 120,
            modalName: "紧急联系人",
            columns: [{
                checkbox: true
            }, {
                field: 'ID',
                title: '序号',
            },
                {
                    field: 'EmergencyName',
                    title: '联系人姓名'
                },
                {
                    field: 'RelationTitle',
                    title: '联系人关系'
                },
                {
                    field: 'Telephone',
                    title: '联系电话'
                },
                {
                    field: 'address',
                    title: '联系地址'
                },
                {
                    field: 'email',
                    title: '电子邮件'
                },
                {
                    field: 'PostCode',
                    title: '邮编'
                }]
        };
        $.table.init(options);
    };
    function emergencyAdd() {
        $.modal.open("新增紧急联系人", prefix + "/addEmergency?id=" + id);
    };
    function emergencyEdit() {
        var row = $("#emergency-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请先选择一条数据");
            return;
        }
        if (row.length > 1) {
            alert("只能选择一条数据");
            return;
        }
        $.modal.open("修改紧急联系人", prefix + "/editEmergency?id=" + row[0].ID);
    };
    function emergencyDelete() {
        var row = $("#emergency-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请选择数据!");
        }
        var allId = "";
        for (var i = 0; i < row.length; i++) {
            if (i == row.length - 1) {
                allId += row[i].ID
            } else {
                allId += row[i].ID + ","

            }
        }
        $.ajax({
            async: false,
            url: prefix + "/deleteEmergency",
            data: {
                "allId": allId
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    $.modal.alertSuccess('删除成功');
                    $("#emergency-table").bootstrapTable('refresh');
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.modal.alertWarning("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
    };
    function emergencyRefresh(){
        $("#emergency-table").bootstrapTable('refresh');
    };

    //证件管理
    function certificate() {
        var options = {
            code: "id",
            uniqueId: "id",
            id: "certificate-table",
            url: prefix + "/getCertificateList?id=" + id,
            removeUrl: prefix + "/remove",
            escape: true,
            showPageGo: true,
            rememberSelected: true,
            height: $(window).height() - 120,
            modalName: "证件管理",
            columns: [{
                checkbox: true
            }, {
                field: 'ID',
                title: '序号',
            },
                {
                    field: 'certtypeTitle',
                    title: '证件类型'
                },
                {
                    field: 'certno',
                    title: '证件编号'
                },
                {
                    field: 'payOrg',
                    title: '颁发机构'
                },
                {
                    field: 'begindate',
                    title: '颁发日期'
                },
                {
                    field: 'term',
                    title: '有效期'
                },
                {
                    field: 'enddate',
                    title: '截止日期'
                },
                {
                    field: 'isDisable',
                    title: '是否失效'
                }]
        };
        $.table.init(options);
    };
    function certificateAdd() {
        $.modal.open("新增证件信息", prefix + "/addCertificate?id=" + id);
    };
    function certificateEdit() {
        var row = $("#Certificate-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请先选择一条数据");
            return;
        }
        if (row.length > 1) {
            alert("只能选择一条数据");
            return;
        }
        $.modal.open("修改紧急联系人", prefix + "/editEmergency?id=" + row[0].ID);
    };
    function certificateDelete() {
        var row = $("#emergency-table").bootstrapTable('getSelections');
        if (row.length == 0) {
            alert("请选择数据!");
        }
        var allId = "";
        for (var i = 0; i < row.length; i++) {
            if (i == row.length - 1) {
                allId += row[i].ID
            } else {
                allId += row[i].ID + ","

            }
        }
        $.ajax({
            async: false,
            url: prefix + "/deleteEmergency",
            data: {
                "allId": allId
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                if (data.code == 0) {
                    $.modal.alertSuccess('删除成功');
                    $("#emergency-table").bootstrapTable('refresh');
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.modal.alertWarning("错误,请联系管理员,错误信息:" + textStatus);
            }
        });
    };
    function certificateRefresh(){
        $("#certificate-table").bootstrapTable('refresh');
    };
</script>
</body>
</html>
